<?php

namespace Bete\View;

use Bete\Foundation\ServiceProvider;

class ViewServiceProvider extends ServiceProvider
{

    protected $defer = true;

    public function register()
    {
        require_once(__DIR__ . '/smarty/Smarty.class.php');

        $this->app->bind('view', function($app) {
            $view = new \Smarty();
            $view->setTemplateDir($this->app['path.view']);
            $view->setCompileDir($this->app['path.storage'] . 
                '/smarty/compile/');
            return $view;
        });
    }

    public function providers()
    {
        return ['view'];
    }
}
